#ifndef IGSLIB_RTC_TIMER_H
#define IGSLIB_RTC_TIMER_H

#include <ctime>
#include <set>
#include "igslib_irtc_timer.h"

namespace igslib 
{
	class CRTCTimer:public IRTCTimer
	{
        protected:
            struct tm* sti; // structured time info
            std::set<IRTCTimerEvent*> events;
        public:
            CRTCTimer()
            {
                time_t rt;
                time(&rt);
                sti = localtime(&rt);
            }
            virtual struct tm GetTime() { return *sti; }
            virtual int SetTime(struct tm value)
            {
                *sti = value;
                return 0;
            }
            virtual void Sync() { }
            virtual void Update() { }
            virtual void ClearError() {}
            virtual void SetEventHandler(IRTCTimerEvent* value) { events.insert(value); }
	};

    class CRTCTimerManager:public IRTCTimerManager
    {
        static IRTCTimerManager* instance;
        public:
            static IRTCTimerManager* GetInstance();
            virtual IRTCTimer* NewM01RTCTimer();
    };
};

#endif
